//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace OpenLS.Spreadsheet.UI
{
    class VerticalCellAlignmentToVerticalAlignmentConverter: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            VerticalCellAlignment a = (VerticalCellAlignment)value;
            switch (a)
            {
                case VerticalCellAlignment.Bottom:
                    return VerticalAlignment.Bottom;
                case VerticalCellAlignment.Center:
                    return VerticalAlignment.Center;
                case VerticalCellAlignment.Distributed:
                case VerticalCellAlignment.Justified:
                    return VerticalAlignment.Stretch;
                case VerticalCellAlignment.Top:
                    return VerticalAlignment.Top;
            }
            throw new NotSupportedException();
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
